'use strict';

/**
 * The main MVC app module.
 *
 * @type {angular.Module}
 */

/* Backend */

var agenceModule = angular.module('agenceModule', ['directives', 'ThumbnailDirectives', 'ModalDirective', 'filters', 'ui.bootstrap']);

	agenceModule.factory('Modal', function() {
		return new ModalModel();
	});
	
	agenceModule.factory('Agence', ['$http', function($http) {
		return new AgenceModel($http);
	}]);
	
	agenceModule.factory('UploadManager', ['$http', '$rootScope', function($http, $rootScope) {
		return new UploadManagerModel($http, $rootScope);
	}]);

	agenceModule.directive('upload', ['UploadManager', function factory(UploadManager) {
	    return new UploadDirective(UploadManager);
	}]);

	agenceModule.controller('AgenceController', ['$scope', 'Agence', 'Modal', AgenceController]);

	agenceModule.controller('AjoutAgenceController', ['$scope', '$rootScope', 'UploadManager', 'Agence', AjoutAgenceController]);

	agenceModule.controller('EditionAgenceController', ['$scope', '$rootScope', 'UploadManager', 'Agence', EditionAgenceController]);
	
var sejourModule = angular.module('sejourModule', ['directives', 'ckEditorDirective', 'ThumbnailDirectives', 'StringsDirectives', 'filters', 'ModalDirective', 'ui.bootstrap', 'ngSanitize']);
	
	sejourModule.factory('Modal', function() {
		return new ModalModel();
	});

	sejourModule.factory('Sejour', ['$http', function($http) {
		return new SejourModel($http);
	}]);
	
	sejourModule.factory('UploadManager', ['$http', '$rootScope', function($http, $rootScope) {
		return new UploadManagerModel($http, $rootScope);
	}]);
	
	sejourModule.directive('upload', ['UploadManager', function factory(UploadManager) {
	    return new UploadDirective(UploadManager);
	}]);

	sejourModule.directive('iscodevalid', ['Sejour', function factory(Sejour) {
	    return new SejourCodeDirective(Sejour);
	}]);

	sejourModule.factory('Agence', ['$http', function($http) {
		return new AgenceModel($http);
	}]);
	
	sejourModule.controller('SejourController', ['$scope', 'Sejour', 'Modal', SejourController]);
	
	sejourModule.controller('AjoutSejourController', ['$scope', '$rootScope', 'UploadManager', 'Sejour', 'Agence',  AjoutSejourController]);
	
	sejourModule.controller('DisponibiliteSejourController', ['$scope', 'Sejour',  DisponibiliteSejourController]);
	
	sejourModule.controller('DaybydaySejourController', ['$scope', 'Sejour',  DaybydaySejourController]);

	sejourModule.controller('FicheSejourController', ['$scope', 'Sejour',  FicheSejourController]);

	sejourModule.controller('EditionSejourController', ['$scope', '$rootScope', 'UploadManager', 'Sejour', 'Agence',  EditionSejourController]);

	sejourModule.controller('GalerieSejourController', ['$scope', '$rootScope', 'UploadManager', 'Sejour',  GalerieSejourController]);
	
var utilisateurModule = angular.module('utilisateurModule', ['directives', 'ModalDirective', 'filters', 'ui.bootstrap']);

	utilisateurModule.factory('Modal', function() {
		return new ModalModel();
	});
	
	utilisateurModule.factory('Utilisateur', ['$http', function($http) {
		return new UtilisateurModel($http);
	}]);

	utilisateurModule.factory('Agence', ['$http', function($http) {
		return new AgenceModel($http);
	}]);
	
	utilisateurModule.factory('Role', ['$http', function($http) {
		return new RoleModel($http);
	}]);
	
	utilisateurModule.controller('AjoutUtilisateurController', ['$scope', 'Utilisateur', 'Role', 'Agence', AjoutUtilisateurController]);
	
	utilisateurModule.controller('UtilisateurController', ['$scope', 'Utilisateur', 'Modal', UtilisateurController]);

	utilisateurModule.controller('EditionUtilisateurController', ['$scope', 'Utilisateur', 'Role', 'Agence', EditionUtilisateurController]);

var sitemapModule = angular.module('sitemapModule', [ 'ui.bootstrap' ]);

	sitemapModule.factory('SitemapManager', ['$http', function($http) {
		return new SitemapModel($http);
	}]);

	sitemapModule.controller('SitemapController', ['$scope', 'SitemapManager', SitemapController]);

var importModule = angular.module('importModule', [ 'ui.bootstrap', 'filters' ]);

	importModule.factory('SitemapManager', ['$http', function($http) {
		return new SitemapModel($http);
	}]);

	importModule.factory('UploadManager', ['$http', '$rootScope', function($http, $rootScope) {
		return new UploadManagerModel($http, $rootScope);
	}]);

	importModule.directive('upload', ['UploadManager', function factory(UploadManager) {
	    return new UploadDirective(UploadManager);
	}]);
	
	importModule.controller('ImportController', ['$scope', '$rootScope', 'UploadManager', ImportController]);

